#!/usr/bin/python
# -*- coding:utf-8 -*-

from django.urls import path, re_path
from rest_framework_mongoengine.routers import DefaultRouter
from .views import (
    RegisterUserView,
    ManagerRegisterUserView,
    PermissionView,
    UserGroupView,
    LoginView,
    RefreshTokenView,
    LogoutView,
    ChangePasswordView,
    ManageChangePasswordView,
    ChangeUsernameView,
    UserInfoView,
    ManageUserInfoView,
    FreezeUserView,
    ManageFreezeUserView,
    ManageActiveUserView,
    QRGeneratorView,
    MfaBindView,
    MfaUnBindView,
    MfaValidateView,
    ManageChangeUserPermissionView,
    UserDetailView,
    BatchDeleteUsersView,
    InputTokenView,
    OutputUrlView,
    OutputTestView
)
from utilities.path_re import PATH_RE_ID


namespace = "account_manager"

urlpatterns = [
    path("register/", RegisterUserView.as_view()),
    path("manage_register/", ManagerRegisterUserView.as_view()),
    path("login/", LoginView.as_view()),
    path('refresh/', RefreshTokenView.as_view()),
    path("logout/", LogoutView.as_view()),
    path("user_info/", UserInfoView.as_view()),
    path("change_pw/", ChangePasswordView.as_view()),
    path("manage_change_pw/", ManageChangePasswordView.as_view()),
    path("change_username/", ChangeUsernameView.as_view()),
    path("freeze_user/", FreezeUserView.as_view()),
    path("manage_freeze_user/", ManageFreezeUserView.as_view()),
    path("manage_active_user/", ManageActiveUserView.as_view()),
    path("change_user_permission/", ManageChangeUserPermissionView.as_view()),
    path("mfa_qr/", QRGeneratorView.as_view()),
    path("mfa_bind/", MfaBindView.as_view()),
    path("mfa_unbind/", MfaUnBindView.as_view()),
    path("mfa_validate/", MfaValidateView.as_view()),
    re_path(rf"^{PATH_RE_ID}/detail/", UserDetailView.as_view()),
    path(rf"delete/batch/", BatchDeleteUsersView.as_view()),
    path(rf"output_url_test/", OutputTestView.as_view()),
]

router = DefaultRouter()
router.register(r"permission", PermissionView)
router.register(r"user_group", UserGroupView)
router.register(r"manage_user_info", ManageUserInfoView)
router.register(r"input_token", InputTokenView)
router.register(r"output_url", OutputUrlView)
urlpatterns += router.urls
